#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2025/10/26 22:02
# @Author  : summer
# @Email   : 610658552@qq.com
# @File    : filter_token.py
# @Software: PyCharm
# @Desc    :
import django_filters
from common.models import Token


class TokenFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name="name", lookup_expr="icontains")
    is_active = django_filters.NumberFilter(field_name="is_active")
    created_after = django_filters.DateTimeFilter(field_name="create_time", lookup_expr="gte")

    class Meta:
        model = Token
        fields = ["name", "is_active", "allowed_ips"]
